home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / ENET.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  4.1 KB  |  147 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ENET.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __ENET__
  18. #define __ENET__
  19.  
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __OSUTILS__
  27. #include <OSUtils.h>
  28. #endif
  29. /*    #include <MixedMode.h>                                        */
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if GENERATINGPOWERPC
  36. #pragma options align=mac68k
  37. #endif
  38.  
  39. #ifdef __CFM68K__
  40. #pragma lib_export on
  41. #endif
  42.  
  43.  
  44. enum {
  45.     ENetSetGeneral                = 253,                            /*Set "general" mode*/
  46.     ENetGetInfo                    = 252,                            /*Get info*/
  47.     ENetRdCancel                = 251,                            /*Cancel read*/
  48.     ENetRead                    = 250,                            /*Read*/
  49.     ENetWrite                    = 249,                            /*Write*/
  50.     ENetDetachPH                = 248,                            /*Detach protocol handler*/
  51.     ENetAttachPH                = 247,                            /*Attach protocol handler*/
  52.     ENetAddMulti                = 246,                            /*Add a multicast address*/
  53.     ENetDelMulti                = 245,                            /*Delete a multicast address*/
  54.     EAddrRType                    = 'eadr'
  55. };
  56.  
  57. typedef struct EParamBlock EParamBlock, *EParamBlkPtr;
  58.  
  59. /*
  60.         ENETCompletionProcPtr uses register based parameters on the 68k and cannot
  61.         be written in or called from a high-level language without the help of
  62.         mixed mode or assembly glue.
  63.  
  64.         In:
  65.          => thePBPtr        A0.L
  66. */
  67.  
  68. #if GENERATINGCFM
  69. typedef UniversalProcPtr ENETCompletionUPP;
  70. #else
  71. typedef Register68kProcPtr ENETCompletionUPP;
  72. #endif
  73.  
  74. struct EParamMisc1 {
  75.     short                            eProtType;                    /*Ethernet protocol type*/
  76.     Ptr                                ePointer;                    /*No support for PowerPC code*/
  77.     short                            eBuffSize;                    /*buffer size*/
  78.     short                            eDataSize;                    /*number of bytes read*/
  79. };
  80. typedef struct EParamMisc1 EParamMisc1, *EParamMisc1Ptr;
  81.  
  82. struct EParamMisc2 {
  83.     char                            eMultiAddr[6];                /*Multicast Address*/
  84. };
  85. typedef struct EParamMisc2 EParamMisc2, *EParamMisc2Ptr;
  86.  
  87. struct EParamBlock {
  88.     QElem                            *qLink;                        /*General EParams*/
  89.     short                            qType;                        /*queue type*/
  90.     short                            ioTrap;                        /*routine trap*/
  91.     Ptr                                ioCmdAddr;                    /*routine address*/
  92.     ENETCompletionUPP                ioCompletion;                /*completion routine*/
  93.     OSErr                            ioResult;                    /*result code*/
  94.     StringPtr                        ioNamePtr;                    /*->filename*/
  95.     short                            ioVRefNum;                    /*volume reference or drive number*/
  96.     short                            ioRefNum;                    /*driver reference number*/
  97.     short                            csCode;                        /*Call command code*/
  98.     union {
  99.         EParamMisc1                        EParms1;
  100.         EParamMisc2                        EParms2;
  101.     } u;
  102. };
  103.  
  104. enum {
  105.     uppENETCompletionProcInfo = kRegisterBased
  106.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(EParamBlkPtr)))
  107. };
  108.  
  109. #if GENERATINGCFM
  110. #define CallENETCompletionProc(userRoutine, thePBPtr)        \
  111.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppENETCompletionProcInfo, (thePBPtr))
  112. #else
  113. /* (*ENETCompletionProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  114. #endif
  115.  
  116. #if GENERATINGCFM
  117. #define NewENETCompletionProc(userRoutine)        \
  118.         (ENETCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppENETCompletionProcInfo, GetCurrentArchitecture())
  119. #else
  120. #define NewENETCompletionProc(userRoutine)        \
  121.         ((ENETCompletionUPP) (userRoutine))
  122. #endif
  123.  
  124. extern pascal OSErr EWrite(EParamBlkPtr thePBptr, Boolean async);
  125. extern pascal OSErr EAttachPH(EParamBlkPtr thePBptr, Boolean async);
  126. extern pascal OSErr EDetachPH(EParamBlkPtr thePBptr, Boolean async);
  127. extern pascal OSErr ERead(EParamBlkPtr thePBptr, Boolean async);
  128. extern pascal OSErr ERdCancel(EParamBlkPtr thePBptr, Boolean async);
  129. extern pascal OSErr EGetInfo(EParamBlkPtr thePBptr, Boolean async);
  130. extern pascal OSErr ESetGeneral(EParamBlkPtr thePBptr, Boolean async);
  131. extern pascal OSErr EAddMulti(EParamBlkPtr thePBptr, Boolean async);
  132. extern pascal OSErr EDelMulti(EParamBlkPtr thePBptr, Boolean async);
  133.  
  134. #ifdef __CFM68K__
  135. #pragma lib_export off
  136. #endif
  137.  
  138. #if GENERATINGPOWERPC
  139. #pragma options align=reset
  140. #endif
  141.  
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145.  
  146. #endif /* __ENET__ */
  147.